package com.example.xd.phone_album

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import kotlinx.android.synthetic.main.activity_main.*


class MainActivity : AppCompatActivity(), View.OnClickListener {
    lateinit var mIntent: Intent
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        tv_picture.setOnClickListener(this)
        tv_video.setOnClickListener(this)
        tv_gl_camera.setOnClickListener(this)
        mIntent = Intent(this, PhoneActivity::class.java)
    }

    override fun onClick(v: View?) {
        when (v) {
            tv_picture -> {
                mIntent.putExtra(TYPE, TYPE_PICTURE)
                startActivity(mIntent)
            }
            tv_video -> {
                mIntent.putExtra(TYPE, TYPE_VIDEO)
                startActivity(mIntent)
            }
            tv_gl_camera -> {
                startActivity(Intent(this, GlSurfaceActivity::class.java))
            }

        }
    }
}
